<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class RepositoryServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        /**
         * 单列模式
         */
        $this->app->singleton('App\Repositories\Contracts\ManagerInterface',function($app){
            return new \App\Repositories\Eloquent\ManagerServiceRepository();
        });
        $this->app->singleton('App\Repositories\Contracts\ArticleInterface',function($app){
            return new \App\Repositories\Eloquent\ArticleServiceRepository();
        });
        $this->app->singleton('App\Repositories\Contracts\CategoryInterface',function($app){
            return new \App\Repositories\Eloquent\CategoryServiceRepository();
        });
    }
}
